package com.lovo.middleman.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lovo.middleman.bean.UserRoleBean;
import com.lovo.middleman.mapper.UserRoleMapper;
import com.lovo.middleman.service.IUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRoleBean> implements IUserRoleService {

    @Autowired
    UserRoleMapper userRoleMapper;

    @Override
    public void addUserRole(int userId, int roleId) {
        UserRoleBean userRoleBean = new UserRoleBean();
        userRoleBean.setUserId(userId);
        userRoleBean.setRoleId(roleId);
        userRoleMapper.insert(userRoleBean);
    }

    @Override
    public void deleteUserRole(int userId) {
        userRoleMapper.deleteById(userId);
    }
}
